package org.frankkie.parcdroidprj;

import android.graphics.Canvas;
import android.graphics.Paint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import java.util.ArrayList;

/**
 *
 * @author frankkie
 */
public class OverlayDebugInfo extends Overlay {

  public static boolean drawDebugLayer = false;
  ArrayList<String> deStrs = new ArrayList<String>();

  @Override
  public void draw(Canvas canvas, MapView mv, boolean bool) {
    if (drawDebugLayer) {
      try {
        super.draw(canvas, mv, bool);
        deStrs.clear();
        deStrs.add("Positie:");
        deStrs.add("" + MainActivity.location.getLatitude());
        deStrs.add("" + MainActivity.location.getLongitude());
        deStrs.add("Accuracy: " + MainActivity.location.getAccuracy());
        deStrs.add("MapCenter:");
        deStrs.add("" + mv.getMapCenter().getLatitudeE6());
        deStrs.add("" + mv.getMapCenter().getLongitudeE6());
        deStrs.add("Zoom: " + mv.getZoomLevel());
        deStrs.add("TimeToFix: " + MainActivity.fixTime);
        deStrs.add("TTS: " + MainActivity.ttsIsInitKlaar + ", " + MainActivity.ttsIsInitKlaarNr);
        deStrs.add("Kind_Code: " + MainActivity.kind_id);
        String watte = "";
        if (MainActivity.fakeLokatieGebruiken) {
          watte = "Fake Lokatie";
        } else {
          watte = "GPS Positie";
        }
        deStrs.add("Lokatie: " + watte);

        Paint paint = new Paint();
        paint.setTextAlign(Paint.Align.LEFT);
        paint.setARGB(100, 0, 0, 0);
        canvas.drawRect(0, 5, 150, 5 + (20 * (deStrs.size() + 1)), paint);
        paint.setTextSize(16);
        paint.setFakeBoldText(true);
        paint.setARGB(255, 255, 0, 0);
        int yy = 25;
        for (int a = 0; a < deStrs.size(); a++) {
          canvas.drawText(deStrs.get(a), 0, deStrs.get(a).length(), 5, yy, paint);
          yy += 20;
        }
        //canvas.drawCircle(50, 50, 500, paint);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
}
